package com.dataaccess.dataaccess.web.service;

import cn.hutool.json.JSONObject;
import com.dataaccess.dataaccess.common.base.BaseService;
import com.dataaccess.dataaccess.support.model.RespEntity;
import com.dataaccess.dataaccess.support.udp.DataReceiveConfigration;
import com.dataaccess.dataaccess.support.utils.MyLogger;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
@Slf4j
public class DeviceAboatCombustiblegasService extends BaseService {

	@Resource
	public MyLogger logger;



	@Resource
	DataReceiveConfigration dataReceiveConfigration;

	/**
	 * 订阅--调用相关接口
	 * @param
	 * @return
	 */
	public RespEntity getInfo(JSONObject jsonParam) {

		return RespEntity.success();
	}

	/**
	 * 回调地址--设备信息变化，订阅后推送设备信息变化通知
	 * @param
	 * @return
	 */
	public RespEntity deviceInfoChanged(JSONObject jsonParam) {

		return RespEntity.success();
	}

	/**
	 * 回调地址：设备数据变化，订阅后推送设备数据变化通知
	 * @param
	 * @return
	 */
	public RespEntity deviceDataChanged(JSONObject jsonParam) {
		//处理支持form-data和json两种方式
		//jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());
		logger.info("gas-------------deviceDataChanged:"+jsonParam.toString());
		dataReceiveConfigration.handleMes(jsonParam.toString(),"http");
		return RespEntity.success();
	}

}
